Merge branch 'master' into table_sorting

Andrew Cantino 10 years ago
parent
commit
40304e1f4b

+ 5 - 0
.env.example

@@ -26,6 +26,11 @@ DATABASE_PASSWORD=""
26 26
 #DATABASE_PORT=3306
27 27
 #DATABASE_SOCKET=/tmp/mysql.sock
28 28
 
29
+# MySQL only: If you are running a MySQL server >=5.5.3, you should
30
+# set DATABASE_ENCODING to utf8mb4 instead of utf8 so that the
31
+# database can hold 4-byte UTF-8 characters like emoji.
32
+#DATABASE_ENCODING=utf8mb4
33
+
29 34
 # ==== Additional required production settings ====
30 35
 
31 36
 # Configure Rails environment.  This should only be needed in production and may cause errors in development.

+ 59 - 10
CHANGES.md

@@ -1,12 +1,61 @@
1 1
 # Changes
2 2
 
3
-* 0.5 (April 20, 2014) - Tons of new additions! FtpsiteAgent; WebsiteAgent has xpath, multiple URL, and encoding support; regexp extractions in EventFormattingAgent; PostAgent takes default params and headers, and can make GET requests; local Graphviz support; ShellCommandAgent; BasecampAgent; HipchatAgent; and lots of bug fixes!
4
-* 0.4 (April 10, 2014) - WebHooksController has been renamed to WebRequestsController and all HTTP verbs are now accepted and passed through to Agents' #receive\_web\_request method. The new DataOutputAgent returns JSON or RSS feeds of incoming Events via external web request.  [Documentation is on the wiki.](https://github.com/cantino/huginn/wiki/Creating-a-new-agent#receiving-web-requests).
5
-* 0.31 (Jan 2, 2014)   - Agents now have an optional keep\_events\_for option that is propagated to created events' expires\_at field, and they update their events' expires\_at fields on change.
6
-* 0.3 (Jan 1, 2014)    - Remove symbolization of memory, options, and payloads; convert memory, options, and payloads to JSON from YAML.  Migration will perform conversion and adjust tables to be UTF-8.  Recommend making a DB backup before migrating.
7
-* 0.2 (Nov 6, 2013)    - PeakDetectorAgent now uses `window_duration_in_days` and `min_peak_spacing_in_days`.  Additionally, peaks trigger when the time series rises over the standard deviation multiple, not after it starts to fall.
8
-* June 29, 2013        - Removed rails\_admin because it was causing deployment issues. Better to have people install their favorite admin tool if they want one.
9
-* June, 2013           - A number of new agents have been contributed, including interfaces to Weibo, Twitter, and Twilio, as well as Agents for translation, sentiment analysis, and for posting and receiving webhooks.
10
-* March 24, 2013 (0.1) - Refactored loading of Agents for `check` and `receive` to use ids instead of full objects.  This should fix the too-large delayed\_job issues.  Added `system_timer` and `fastercsv` to the Gemfile for the Ruby 1.8 platform.
11
-* March 18, 2013       - Added Wiki page about the [Agent API](https://github.com/cantino/huginn/wiki/Creating-a-new-agent).
12
-* March 17, 2013       - Switched to JSONPath for defining paths through JSON structures.  The WebsiteAgent can now scrape and parse JSON.
3
+* Sep 8, 2014    - SchedulerAgent added, allowing granular control of Agent schedules.  Agents can now control other Agents via `ControlLinks`.
4
+                 - Liquid filter `to_uri` added.
5
+* Sep 7, 2014    - Optional delayed\_job\_web replaced by a custom UI for managing failed and queued jobs.
6
+* Sep 6, 2014    - Agent's `last_event_at` is now updated only on Event creation, not on updates.
7
+* Sep 4, 2014    - Spring, an application preloader intergated with Rails 4.1, has been added.
8
+* Sep 3, 2014    - Liquid interpolation in the WebsiteAgent now has a `_response_` variable available.
9
+* Aug 31, 2014   - Fix a bug where AgentLogs errored after a referenced Event was deleted.
10
+                 - HumanTaskAgent can emit separate events for each answer.
11
+* Aug 30, 2014   - Set charset/collation properly for each text column if using MySQL.
12
+                 - One-click "Deploy to Heroku" button added in README.
13
+* Aug 28, 2014   - Liquid filter `to_xpath` added, which quotes a string for use in XPath expression.
14
+* Aug 26, 2014   - Transition to new Services model for managing external authorization with omniauth.
15
+* Aug 21, 2014   - WebsiteAgent has a new `text` parser type.
16
+                 - Scenario tags have a customizable foreground and background color.
17
+                 - HTML is sanitized and supported in emails.
18
+* Aug 20, 2014   - Support for markdown in Scenario descriptions added.
19
+* Aug 17, 2014   - TwitterStream no longer tries to run disabled Agents.  Sleep and thread bugs fixed in the EM code.
20
+* Aug 13, 2014   - `created_at` added as an available Liquid variable.
21
+                 - Enable Graphviz on Heroku.
22
+* Aug 12, 2014   - Add an environment variable (`DEFAULT_HTTP_USER_AGENT`) to set a global default User-Agent value.
23
+                 - Hover menu to the "Agents" nav link added.
24
+* Aug 9, 2014    - ChangeDetectorAgent added.
25
+* Aug 8, 2014    - Make PostAgent use WebRequestConcern, adding options for Basic Auth and User-Agent.
26
+* Aug 5, 2014    - Use 'net-ftp-list' gem to parse ftp directory listing.
27
+* Aug 1, 2014    - Adding a badge to each Agent node in a diagram.
28
+* Jul 31, 2014   - Allow HipchatAgent to use a shared Credential.
29
+* Jul 29, 2014   - The upstream Agent is now available in the EventFormattingAgent in Liquid via the `agent` key.
30
+                 - The WebsiteAgent is now much more powerful, supporting full XPath evaluations in extractions.
31
+* Jul 26, 2014   - Easy Heroku deployment added and document in the wiki!
32
+* Jul 25, 2014   - Simple RSSAgent added for parsing RSS feeds (the WebsiteAgent has always been able to do this, but this new Agent is simpler).
33
+                 - Nicer Agent diagrams.
34
+* Jul 20, 2014   - Email Agents can send to more than one recipient using the new `recipients` array.
35
+* Jun 29, 2014   - PostAgent can send more HTTP verbs, use both json and html form encoding, and merge event payloads.
36
+* Jun 18, 2014   - Scenarios added, allowing Agents to be grouped, imported, and exported.
37
+                 - `interpolated_options` added so that most Agent options can contain Liquid markup.
38
+* Jun 12, 2014   - XML namespaces are ignored by the WebsiteAgent when evaluating XPath.
39
+* Jun 9, 2014    - User edit form split and cleaned up.
40
+* Jun 8, 2014    - Upgraded to Rails 4.1.1.
41
+* Jun 5, 2014    - MQTTAgent added.
42
+* Jun 1, 2014    - SlackAgent added.
43
+                 - Liquid tag for accessing Credentials added.
44
+                 - Requests to /worker\_status  no longer spam the log.
45
+                 - GoogleCalendarAgent added.
46
+* May 19, 2014   - ImapFolderAgent added.
47
+* May 11, 2014   - Combine some of the Foreman processes into threads for lower memory usage.
48
+* May 6, 2014    - Agents can be disabled or enabled.
49
+* May 5, 2014    - JiraAgent added.
50
+* May 3, 2014    - If you're using Capistrano, `cap sync:db:down` now works correctly to pull your production DB to your local environment.
51
+* May 1, 2014    - Upgrade to Bootstrap 3.1.1
52
+* Apr 20, 2014   - Tons of new additions! FtpsiteAgent; WebsiteAgent has xpath, multiple URL, and encoding support; regexp extractions in EventFormattingAgent; PostAgent takes default params and headers, and can make GET requests; local Graphviz support; ShellCommandAgent; BasecampAgent; HipchatAgent; and lots of bug fixes!
53
+* Apr 10, 2014   - WebHooksController has been renamed to WebRequestsController and all HTTP verbs are now accepted and passed through to Agents' #receive\_web\_request method. The new DataOutputAgent returns JSON or RSS feeds of incoming Events via external web request.  [Documentation is on the wiki.](https://github.com/cantino/huginn/wiki/Creating-a-new-agent#receiving-web-requests).
54
+* Jan 2, 2014    - Agents now have an optional keep\_events\_for option that is propagated to created events' expires\_at field, and they update their events' expires\_at fields on change.
55
+* Jan 1, 2014    - Remove symbolization of memory, options, and payloads; convert memory, options, and payloads to JSON from YAML.  Migration will perform conversion and adjust tables to be UTF-8.  Recommend making a DB backup before migrating.
56
+* Nov 6, 2013    - PeakDetectorAgent now uses `window_duration_in_days` and `min_peak_spacing_in_days`.  Additionally, peaks trigger when the time series rises over the standard deviation multiple, not after it starts to fall.
57
+* Jun 29, 2013   - Removed rails\_admin because it was causing deployment issues. Better to have people install their favorite admin tool if they want one.
58
+* Jun, 2013      - A number of new agents have been contributed, including interfaces to Weibo, Twitter, and Twilio, as well as Agents for translation, sentiment analysis, and for posting and receiving webhooks.
59
+* Mar 24, 2013   - Refactored loading of Agents for `check` and `receive` to use ids instead of full objects.  This should fix the too-large delayed\_job issues.  Added `system_timer` and `fastercsv` to the Gemfile for the Ruby 1.8 platform.
60
+* Mar 18, 2013   - Added Wiki page about the [Agent API](https://github.com/cantino/huginn/wiki/Creating-a-new-agent).
61
+* Mar 17, 2013   - Switched to JSONPath for defining paths through JSON structures.  The WebsiteAgent can now scrape and parse JSON.

+ 2 - 2
app/controllers/application_controller.rb

@@ -15,7 +15,7 @@ class ApplicationController < ActionController::Base
15 15
   end
16 16
 
17 17
   def authenticate_admin!
18
-    redirect_to(root_path, alert: 'Admin access required to view that page.') unless current_user && current_user.admin
18
+    redirect_to(root_path, alert: 'Admin access required to view that page.') unless current_user && current_user.admin?
19 19
   end
20 20
 
21 21
   def upgrade_warning
@@ -25,6 +25,7 @@ class ApplicationController < ActionController::Base
25 25
   end
26 26
 
27 27
   private
28
+
28 29
   def twitter_oauth_check
29 30
     if ENV['TWITTER_OAUTH_KEY'].blank? || ENV['TWITTER_OAUTH_SECRET'].blank?
30 31
       if @twitter_agent = current_user.agents.where("type like 'Agents::Twitter%'").first
@@ -39,5 +40,4 @@ class ApplicationController < ActionController::Base
39 40
       @basecamp_agent = current_user.agents.where(type: 'Agents::BasecampAgent').first
40 41
     end
41 42
   end
42
-
43 43
 end

+ 0 - 4
app/helpers/application_helper.rb

@@ -38,8 +38,4 @@ module ApplicationHelper
38 38
       link_to 'No', agent_path(agent, tab: (agent.recent_error_logs? ? 'logs' : 'details')), class: 'label label-danger'
39 39
     end
40 40
   end
41
-
42
-  def user_is_admin?
43
-    current_user && current_user.admin == true
44
-  end
45 41
 end

+ 4 - 1
spec/controllers/jobs_controller_spec.rb

@@ -10,10 +10,13 @@ describe JobsController do
10 10
     end
11 11
 
12 12
     it "does not allow normal users" do
13
+      users(:bob).should_not be_admin
13 14
       sign_in users(:bob)
14 15
       get(:index).should redirect_to(root_path)
15 16
     end
16
-    it "returns all jobs", focus: true do
17
+
18
+    it "returns all jobs" do
19
+      users(:jane).should be_admin
17 20
       sign_in users(:jane)
18 21
       get :index
19 22
       assigns(:jobs).length.should == 2